package com.util;

import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class PrintJsonData {

    public static void printData(HttpServletResponse resp,LayData success){
        PrintWriter writer = null;
        try {
            writer = resp.getWriter();
        } catch (IOException e) {
            e.printStackTrace();
        }
        String s = JSON.toJSONString(success);
        if (writer != null) {
            writer.print(s);
        }
        if (writer != null) {
            writer.flush();
        }
        if (writer != null) {
            writer.close();
        }
    }

}
